import { stringify } from 'qs';
import request from '@/utils/request';

import webpath from '@/utils/webpath';

export async function deleteByPrimaryKeyForArea(params = {}) {
    return request(`/${webpath}/web/api/service/area/delete?${stringify(params)}`);
}


export async function selectByPrimaryKeyForArea(params = {}) {
    return request(`/${webpath}/web/api/service/area/get?${stringify(params)}`);
}


export async function insertForArea(params = {}) {
    return request(`/${webpath}/web/api/service/area/insert`, {
        method: 'POST',
        data: {
            ...params,
            method: 'insert',
        },
    });
}


export async function updateForArea(params = {}) {
    return request(`/${webpath}/web/api/service/area/update`, {
        method: 'POST',
        data: {
            ...params,
            method: 'update',
        },
    });
}


export async function deleteByMapForArea(params = {}) {
    return request(`/${webpath}/web/api/service/area/deleteByMap`, {
        method: 'POST',
        data: {
            ...params,
            method: 'delete',
        },
    });
}


export async function updateByMapForArea(params = {}) {
    return request(`/${webpath}/web/api/service/area/updateByMap`, {
        method: 'POST',
        data: {
            ...params,
            method: 'update',
        },
    });
}


export async function getOneForArea(params = {}) {
    return request(`/${webpath}/web/api/service/area/getOne`, {
        method: 'POST',
        data: {
            ...params,
            method: 'fetch',
        },
    });
}



export async function getAllForArea(params = {}) {
    return request(`/${webpath}/web/api/service/area/getAll`, {
        method: 'POST',
        data: {
            ...params,
            method: 'fetch',
        },
    });
}


export async function queryPageForArea(params = {}) {
    return request(`/${webpath}/web/api/service/area/queryPage`, {
        method: 'POST',
        data: {
            ...params,
            method: 'fetch',
        },
    });
}


export async function countForArea(params = {}) {
    return request(`/${webpath}/web/api/service/area/count`, {
        method: 'POST',
        data: {
            ...params,
            method: 'fetch',
        },
    });
}

export async function insertBatchForArea(params = {}) {
    return request(`/${webpath}/web/api/service/area/insertBatch`, {
        method: 'POST',
        data: {
            ...params,
            method: 'insert',
        },
    });
}


export async function deleteBatchForArea(params = {}) {
    return request(`/${webpath}/web/api/service/area/deleteBatch`, {
        method: 'POST',
        data: {
            ...params,
            method: 'delete',
        },
    });
}


export async function updateBatchForArea(params = {}) {
    return request(`/${webpath}/web/api/service/area/updateBatch`, {
        method: 'POST',
        data: {
            ...params,
            method: 'update',
        },
    });
}

export async function getAreaTreeByParentid(params = {}) {
    return request(`/${webpath}/web/api/service/area/getAreaTreeByParentid`, {
        method: 'POST',
        data: {
            ...params,
            method: 'fetch',
        },
    });
}

export async function updateChangeTargetNodeWithSourceNode(params = {}) {
    return request(`/${webpath}/web/api/service/area/updateChangeTargetNodeWithSourceNode`, {
        method: 'POST',
        data: {
            ...params,
            method: 'update',
        },
    });
}
